package com.leo;

import com.almasb.fxgl.app.GameApplication;
import com.almasb.fxgl.app.GameSettings;
import com.almasb.fxgl.core.math.FXGLMath;
import com.almasb.fxgl.dsl.FXGL;
import com.almasb.fxgl.entity.Entity;
import com.almasb.fxgl.entity.SpawnData;
import com.almasb.fxgl.entity.components.ViewComponent;
import com.almasb.fxgl.texture.Texture;
import com.leo.entity.ImageEntityFactory;
import javafx.geometry.Rectangle2D;

/**
 * @Author: wangss
 * @CreateTime: 2023-06-02  12:36
 * @Description: TODO
 */
public class PictureApp extends GameApplication {
    @Override
    protected void initSettings(GameSettings settings) {

    }

    @Override
    protected void initGame() {
        FXGL.getGameWorld().addEntityFactory(new ImageEntityFactory());
        FXGL.spawn("car");
        FXGL.spawn("boom", new SpawnData(400, 400));
        FXGL.spawn("shooter", new SpawnData(0, 400));
        FXGL.spawn("miku", new SpawnData(600, 200));
        FXGL.spawn("run", new SpawnData(600, 400));

        for (int i = 0; i < 5; i++) {
            FXGL.spawn("tank", FXGLMath.randomPoint(new Rectangle2D(0, 0, 300, 300)));
        }

        // 生成一个坦克，点击一次改变一次颜色
        Entity tank = FXGL.spawn("tank", FXGLMath.randomPoint(new Rectangle2D(0, 0, 600, 600)));
    }

    public static void main(String[] args) {
        launch(args);
    }
}
